import React, { Component } from 'react'
import axios from 'axios'

export default class App extends Component {

    getStudentData = () => {
        axios.get('http://localhost:3000/api1/students').then(res => {
            console.log('成功', res);
        }, err => {
            console.log('失败', err);
        })
    }
    getCarData = () => {
        axios.get('http://localhost:3000/api2/cars').then(res => {
            console.log('成功', res);
        }, err => {
            console.log('失败', err);
        })
    }
    render() {
        return (
            <div>
                <button onClick={this.getStudentData}>点击获取数据1</button>
                <button onClick={this.getCarData}>点击获取数据2</button>
            </div>
        )
    }
}
